#!/usr/bin/env python
# -*- coding: utf8 -*-

'''
Created on 2011-8-1

@author: zhongfeng
'''

from coo8.coo8pageparser import Coo8AllSortParser,Coo8Sort3PageParser,Coo8Sort4PageParser
from pageparser import ObuyUrlSummary
from spider import ObuySpider

if __name__ == '__main__':

    parserDict = {0:Coo8AllSortParser,3:Coo8Sort3PageParser,4:Coo8Sort4PageParser}
    
    sort3 = ObuyUrlSummary(url = r'http://www.coo8.com/products/290-13980-0-0-0-0.html',name='coo8',  
                                 isRecursed = True,catagoryLevel = 3)
    
    digitRoot = ObuyUrlSummary(url = r'http://www.360buy.com/products/652-653-659-0-0-0-0-0-0-0-1-1-2.html', 
                               name='digital',isRecursed = False,catagoryLevel = 4)
    
    Coo8Root = ObuyUrlSummary(url = r'http://www.coo8.com/allcatalog/',name='coo8',  
                                 isRecursed = True,catagoryLevel = 0)

    pcare  = ObuyUrlSummary(url = r'http://www.360buy.com/products/652-653-000.html', 
                               name='手机',isRecursed = False,catagoryLevel = 2)
    
    pdigital  = ObuyUrlSummary(url = r'http://www.360buy.com/digital.html',name='digital',catagoryLevel = 1)
    
    pelectronic  = ObuyUrlSummary(url = r'http://www.360buy.com/electronic.html',name='electronic',catagoryLevel = 1)
    
    pcomputer  = ObuyUrlSummary(url = r'http://www.360buy.com/computer.html',name='computer',catagoryLevel = 1)
    
    includes = [pelectronic,pdigital,pcomputer]
    
    spider = ObuySpider(rootUrlSummary = Coo8Root,parserDict = parserDict,include = None,exclude = None,threadNum = 10)
    
    spider.spide()
    